BEGIN {
	FS = "[\t \n\r]";
}


{
	print "INSERT INTO devices (name, nodeId, type) VALUES ('" $2 "@" device "','" $1 "', 'Application');"
	print "UPDATE dataobjects SET type='ApplicationTo' WHERE dataobjectId IN (SELECT substr(e.dataobjectId,1,40) as dobjId FROM events as e WHERE e.nodeId='" $1 "' GROUP BY dobjId);"
}
